import jfRequest from "../../index";
import { IResultType } from "types/request";
import { ISalaryList, IReSalaryList, IAddFirstStep } from "./type";

// 获取发布列表
export function getSalaryList(SalaryList: ISalaryList) {
  return jfRequest.post<IResultType<IReSalaryList>>({
    url: "/api/v1/web/wage/release/list",
    data: SalaryList,
  });
}

// 工资详情
export function GetSalaryInfo(id: String) {
  return jfRequest.get<IResultType<any>>({
    url: "/api/v1/web/wage/release/" + id,
  });
}

// 删除工资发布数据
export function DeleteSalary(id: String) {
  return jfRequest.delete<IResultType<any>>({
    url: "/api/v1/web/wage/release/" + id,
  });
}

// 撤回工资发布数据
export function ReBackSalary(id: String) {
  return jfRequest.put<IResultType<any>>({
    url: "/api/v1/web/wage/release/recall/" + id,
  });
}

// 确认发布工资数据
export function pubSalary(id: String) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/release/commitRelease/" + id,
  });
}

// 填写第一步基本信息
export function addFirstStep(data: IAddFirstStep) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/release/baseInfo",
    data,
  });
}

// 更新 填写第一步基本信息
export function UpdateFirstStep(data: IAddFirstStep) {
  return jfRequest.put<IResultType<any>>({
    url: "/api/v1/web/wage/release/baseInfo",
    data,
  });
}

// 获取工资模板列表
export function getSalaryModelList(data: any) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/template/list",
    data,
  });
}

// 下载模板
export function downLoadModel(id: string) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/template/export/" + id,
  });
}

// 上传工资模板
export function uploadModel(id: string, data: any) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/release/import/" + id,
    data,
  });
}

// 上传工资模板完成
export function uploadModelNext(id: string) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/release/importCompleted/" + id,
  });
}

// 获取上传后的工资数据
export function getSalaryData(id: string) {
  return jfRequest.get<IResultType<any>>({
    url: "/api/v1/web/wage/release/data/" + id,
  });
}

// 确认发布工资
export function publishSalary(id: string) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/release/commitRelease/" + id,
  });
}

// 处理重复数据
export function handleRepeat(data: any) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/web/wage/release/handleRepeat",
    data,
  });
}
